<template>
    <div class="home">
        <Header />
        <Cov19Info :cov19Info="cov19Info"/>
        <case-num :caseNumDate="caseNumDate"/>
        <Map/>
        <my-swpier/>
        <spring-travel/>
    </div>
</template>

<script>
import Header from '../components/Header'
import api from '../api'
import Cov19Info from '../components/Cov19Info'
import CaseNum from '../components/CaseNum.vue'
import Map from '../components/Map.vue'
import MySwpier from '../components/MySwpier.vue'
import SpringTravel from '../components/SpringTravel.vue'


export default {
    name: 'Home',
    data(){
        return {
            // 疫情信息：cov19Info
            cov19Info:{
                note1:"",
                note2:"",
                note3:"",
                remark1:"",
                remark2:"",
                remark3:"",
            },
            // 感染人数
            caseNumDate: {
                time:"",
                currentConfirmedCount:"",   // 现确诊人数
                confirmedCount:"",      // 累计确诊人数
                suspectedCount:"",      // 累计境外输入人数
                curedCount:"",          // 累计治愈人数
                deadCount:"",           // 累计死亡人数
                seriousCount:"",        // 现存无症状人数
                suspectedIncr:"",       // 新增境外输入人数
                currentConfirmedIncr:"",    // 相比昨天现存确诊人数
                confirmedIncr:"",           // 相比昨天累计确诊人数
                curedIncr:"",           // 相比昨天新增治愈人数
                deadIncr:"",            // 相比昨天新增死亡人数
                seriousIncr:"",          // 相比昨天现存无症状人数
            }
        }
    },
    components: {
        Header,
        Cov19Info,
        CaseNum,
        Map,
        MySwpier,
        SpringTravel },
    mounted() {
        api.getNcov({
            key:"0235e53ec175aecf45c661dc3fcbba38"
        }).then(res=>{
            if (res.status === 200) {
                // console.log(res);
                const{desc} = res.data.newslist[0]
                // 疫情信息数据
                this.cov19Info.note1 = desc.note1
                this.cov19Info.note2 = desc.note2
                this.cov19Info.note3 = desc.note3
                this.cov19Info.remark1 = desc.remark1
                this.cov19Info.remark2 = desc.remark2
                this.cov19Info.remark3 = desc.remark3

                // 疫情病例数
                this.caseNumDate={
                    time : desc.modifyTime,
                    currentConfirmedCount:desc.currentConfirmedCount,
                    confirmedCount:desc.confirmedCount,
                    suspectedCount:desc.suspectedCount,
                    curedCount:desc.curedCount,
                    deadCount:desc.deadCount,
                    seriousCount:desc.seriousCount,
                    currentConfirmedIncr:desc.currentConfirmedIncr,
                    confirmedIncr:desc.confirmedIncr,
                    curedIncr:desc.curedIncr,
                    deadIncr:desc.deadIncr,
                    seriousIncr:desc.seriousIncr,
                    suspectedIncr:desc.suspectedIncr,
                }
                // console.log(this.caseNumDate);
            }
        }).catch((err)=>{
            console.log(err);
        })
    }
}
</script>

<style>

</style>